Ext.namespace('iOS.BaseView');

Ext.define('BaseDom', {
    
    statics : {
    },
    
    /*
     * 随机Id生成列表
     */
    _curIdx    : 0,
    
    constructor: function(){
        var cfgs    = iOS.Config;
        var subView = cfgs.subViewCfg;
        this.init(subView);
    },
    
    init: function(subView){
        var that   = this;
        $.each(subView, function(index, value){
            that._build(value.paramter, value);
        });
    },
    
    _build: function(paramter, cfg){
        if(Ext.isEmpty(paramter.name)){
            return;
        }
        var that          = this;
        var paramter      = cfg.paramter;
        paramter.selector = this._getSelector();
        var clz           = cfg.clz;
        var obj           = new clz(paramter);
        var subView       = paramter.subViewCfg;
        if(subView){
            $.each(subView, function(index, value){
                that._build(value.paramter, value);    
            });
        }
        if(cfg.isCard){
            obj._cards     = subView;
            obj.toolBar    = cfg.toolBar;
            obj._barHeight = cfg.barHeight;
            obj._barCfg    = cfg.barCfg;
            obj._initSubCard();
        }
    },
    
    _getSelector: function(){
        var selector  = '#ios-' + this._curIdx;
        this._curIdx++;
        return selector;
    },
    
});